package com.example.sysao.service.impl;

import com.example.sysao.mapper.DoorMapper;
import com.example.sysao.pejo.Door;
import com.example.sysao.service.DoorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DoorServiceImp implements DoorService {
    @Resource
    private DoorMapper doorMapper;

    @Override
    public List<Door> findAll() {
        return doorMapper.selectAll();
    }

    @Override
    public List<Door> findByName(String name) {
        return doorMapper.selectByName(name);
    }

    @Override
    public Door findByname(String name) {
        return doorMapper.selectByname(name);
    }

    @Override
    public List<Door> findAllDoors() {
        return doorMapper.selectall();
    }

    @Override
    public boolean addDoor(Door door) {
        return doorMapper.insertDoor(door) != 0;
    }

    @Override
    public boolean saveDoor(Door door) {
        return doorMapper.updateDoor(door) != 0;
    }
}
